package com.woniuxy.controller;


import com.woniuxy.anno.LogAnnotation;
import com.woniuxy.anno.RateLimit;
import com.woniuxy.entity.dto.AdmissionDTO;

import com.woniuxy.entity.AdmissionForm;

import com.woniuxy.entity.dto.InHospitalDTO;
import com.woniuxy.service.AdmissionFormService;
import com.woniuxy.util.PageParam;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/form")
public class AdmissionFormController {
    @Autowired
    AdmissionFormService admissionFormService;

    @PostMapping("/querylist")
    @RateLimit(time = 3,maxCount = 3)
    @LogAnnotation
    public ResponseData queryList(@RequestBody PageParam<AdmissionDTO> pageParam){
        return admissionFormService.queryList(pageParam);
    }

    @GetMapping("/queryde")
    public ResponseData queryDe(){
        return admissionFormService.queryTdeList();
    }

    @PostMapping ("/querysickbed")
    public ResponseData querySickBed(@RequestBody AdmissionDTO admissionDTO){
        return admissionFormService.querySickbed(admissionDTO);
    }

    //添加住院申请
    @PostMapping("addAdmissionForm")
    public ResponseData<?> addAdmissionForm(@RequestBody AdmissionForm admissionForm){
        return admissionFormService.addAdmissionForm(admissionForm);
    }

    @PostMapping("updateAF")
    public ResponseData<?> updateAF(@RequestBody InHospitalDTO inHospitalDTO){
        return admissionFormService.updateAdmissionForm(inHospitalDTO);
    }

    @GetMapping("/queryoutde")
    public ResponseData queryOutDe(){
        return admissionFormService.queryOutList();
    }
}
